const http = require('http')

const server = http.createServer((req, res) => {
  let requestBody = ''
  // 监听data事件，获取请求体数据
  req.on('data', chunk => {
    requestBody += chunk
  })
  // 监听end事件，请求结束输出请求体数据
  req.on('end', () => {
    console.log(requestBody)
    res.end('http')
  })
})

server.listen(9000, () => {
  console.log('服务启动成功...')
})